package com.david.course_design.shopping_center.module.shoppingCart.mapper;

import com.david.course_design.shopping_center.module.shoppingCart.entity.ShoppingCart;
import org.apache.ibatis.annotations.Select;
import tk.myBatis.mapper.MyBaseMapper;

import java.util.List;

public interface ShoppingCartMapper extends MyBaseMapper<ShoppingCart> {
    @Select("select *\n" +
            "from t_shopping_cart as t\n" +
            "where t.goods_id = #{ goodsId } and t.user_id = #{ userId }")
    ShoppingCart selectShoppingCartItemByUserIdAndGoodsId(Integer userId, Integer goodsId);

    @Select("select *\n" +
            "from t_shopping_cart as t\n" +
            "where t.user_id = #{ userId }")
    List<ShoppingCart> selectAllShoppingCartItemByUserId(Integer userId);
}